<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>经销商能力提升-角色与权限设置</title>
<META content="text/html; charset=UTF-8" http-equiv=Content-Type>

<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="0">
<%@include file="../../../include/include.jsp"%>
<link rel="stylesheet" type="text/css" href="${webcontext}/css/datepicker.css" />
<link rel="stylesheet" type="text/css" href="${webcontext}/css/public.css" />
<link rel="stylesheet" type="text/css" href="${webcontext}/css/style_l.css" />

<script src="${jspath}/jquery/jquery-1.4.4.js" type="text/javascript"></script>
<script type="text/javascript" src="${webcontext}/javascript/jquery/jquery.ui.min.js"></script>
<script type="text/javascript" src="${webcontext}/javascript/ui.datepicker_zh-CN.js"></script>
<script type="text/javascript" src="${webcontext}/javascript/jquery/jquery.blockUI.js"></script>
<script type="text/javascript" src="${webcontext}/javascript/load_layer.js"></script>
<script type="text/javascript" src="${webcontext}/javascript/public.js"></script>

<script src="${jspath}/jquery/tree/jquery.jstree.js" type="text/javascript"></script>
<script src="${jspath}/jquery/tree/dmsTree.js" type="text/javascript"></script>
<script src="${jspath}/jquery/tree/menuTree.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css"
	href="${webcontext}/css/validationEngine.jquery.css" />
<script src="${jspath}/jquery/validate/jquery.validationEngine.js"
	type="text/javascript"></script>
<script src="${jspath}/jquery/validate/jquery.validationEngine-zh.js"
	type="text/javascript"></script>
	<script type="text/javascript"
	src="${webcontext}/javascript/jquery/jquery.ui.draggable.js"></script>
<script type="text/javascript"
	src="${webcontext}/javascript/jquery/jquery.alerts.js"></script>
<link rel="stylesheet" type="text/css"
	href="${webcontext}/css/jquery.alerts.css" />
<style type="text/css">
.formError .formErrorContent {
    -moz-border-radius: 6px 6px 6px 6px;
    -moz-box-shadow: 0 0 6px #000000;
    background: none repeat scroll 0 0 #EE0101;
    border: 2px solid #DDDDDD;
    color: #FFFFFF;
    font-family: tahoma;
    font-size: 11px;
    padding: 4px 10px;
    width: 100px;
}
</style>
<script type="text/javascript">
var myHeight = 0;
$(function(){
	selectRegionType(2);
	var checkedMenus = eval("${roleAndFunctionsDto.checkedMenuIdList}");
	defaultChecked(roleType, checkedMenus);

	$("#roleType").val(roleType);
	
	$("#add_Form").validationEngine(
			{
             promptPosition:"topLeft",
             success:false,
			 failure:function(){} 
			 });

   $("#cancel").click(function(){
	   history.back();
      //window.location.href = "${webcontext}/dm/userperm/rolefunc/index";
	});
}); 

function doSubmit()
{
	if(!$("#add_Form").validationEngine(
			{
             promptPosition:"topLeft",
           	 returnIsValid:true
			 })){
		return;
	}
	var checkedMenuArray = getCheckedValue();
	if (checkedMenuArray.length == 0) {
		$.validationEngine.buildPrompt("#menuTree", "* 请选择要增加的菜单功能项","error");
		return;
    } 
	jConfirm("确认分配选中的菜单功能项给此角色？", "操作提示", function(result) {
		if(result) {
			$("#menuIds").val(checkedMenuArray);
			//alert(checkedOrgArray);
			$("#add_Form").submit();
		}
	})
} 
</script>
</head>
<body>

	<!-- content -->
	<div id="content">
		<!-- wrap -->
		<div id="wrap">
        <form:form id="add_Form" action="${webcontext}/dm/userperm/rolefunc/update" method="post" modelAttribute="roleAndFunctionsDto">
        <form:hidden path="id"/>
        <input type="hidden" id="menuIds" name="checkedMenuIdList" />
			<div id="breadcrumb">
				<span>经销商能力提升</span>
				<span>&gt;</span>
				<span>角色与权限设置</span>
			</div>
			<!-- /breadcrumb -->

			<!-- info_div -->
			<div class="input_div">
				<div class="title">
					<p>角色与权限设置</p>
				</div>
                <div>
				<table class="search_tab">
                	<tr>
                    	<td class="label">角色代码：</td>
						<td>
							<form:input path="roleCode" cssClass="text string" readOnly="true"/>
						</td>
                        <td class="label"><span class="need">*</span>角色名称：</td>
						<td>
							<form:input path="roleName" cssStyle="width:300px;" cssClass="validate[length[1,100]] text string"/>
						</td>
						<td class="label">角色类型：</td>
						<td>
							<form:input path="roleTypeStr" cssClass="text string" readOnly="true"/>
						</td>
					</tr>
				</table>
                </div>
			</div>
			<!-- /info_div -->
            
            <div class="spliter h_10"></div>
            
            <!-- input_div -->
			<div class="input_div">
				<div class="title">
					<span>菜单权限 </span>
			  </div>
		          <span>
				</span>
						<!-- dealer -->
						<div id="area_jxs">
								<div class="spliter h_5"></div>
                            <!-- tree -->
                            <div id="menuTree" class="tree_div">
                            </div>
                            <!-- /tree -->
							</div>
							<!-- /dealer -->
			</div>
				<div class="spliter h_5"></div>
			
			<!-- /input_div -->

          
		
        
        <div class="spliter h_5"></div>
              <div class="btn_div">
                <input type="button" class="btn" value="确认" id="save" onclick="doSubmit();"/>
                <input type="button" class="btn" value="取消" id="cancel"/>
              </div>
    	<div class="spliter h_5"></div>

		</form:form>

		</div>
		<!-- /wrap -->
	</div>
	<!-- /content -->

</body>
</html>